function y = CreateObjectModel(para)
% returns a cell data type model
% ver5.0: return a set of segment, each segment includes 2 endpoints
%         using object (centimeter) coordinates to create model
%         clockwise naming order A->B->C->D 

a = para(1);
b = para(2);
c = para(3);
d = para(4);

model = [];

% Master Rectangle/Square
model(:,:,1) = [0 0;0 a];    % AB see p12
model(:,:,2) = [0 a;b a];    % BC
model(:,:,3) = [b a;b 0];    % CD
model(:,:,4) = [b 0;0 0];

% top lelf sub-square
% y = d
model(:,:,5) = [d d+c;d d];
% x = d+c
model(:,:,6) = [d+c d+c;d d+c];
% y = d+c
model(:,:,7) = [d d+c;d+c d+c];
% x = d
model(:,:,8) = [d d;d d+c];

% top right sub-square
% y = d
model(:,:,9) = [a-d-c a-d;d d];
% x = a-d
model(:,:,10) = [a-d a-d;d d+c];
% y = d+c
model(:,:,11) = [a-d-c a-d;d+c d+c];
% x = a-d-c
model(:,:,12) = [a-d-c a-d-c;d d+c];

% low right sub-square
% y = b-d-c
model(:,:,13) = [a-d-c a-d;b-d-c b-d-c];
% x = a-d
model(:,:,14) = [a-d a-d;b-d-c b-d];
% y = b-d
model(:,:,15) = [a-d-c a-d;b-d b-d];
% x = a-d-c
model(:,:,16) = [a-d-c a-d-c;b-d-c b-d];

% low lelf sub-square
% y = b-d-c
model(:,:,17) = [d d+c;b-d-c b-d-c];
% x = d+c
model(:,:,18) = [d+c d+c;b-d-c b-d];
% y = b-d
model(:,:,19) = [d d+c;b-d b-d];
% x = d
model(:,:,20) = [d d;b-d-c b-d];

y = model;
end
